package com.gtfrank.web.servlet.day2;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @ProjectName: sudacoursetrainging
 * @ClassName: LifeServlet
 * @PackageName:com.gtfrank.web.servlet.day2
 * @Description:  讲解Servlet的生命周期
 * @Author: frank
 * @Date: 2021/4/28 13:43
 * @Version v1.0
 */
@WebServlet(name = "LifeServlet" ,value = "/day2/LifeServlet")
public class LifeServlet extends HttpServlet {
    @Override
    public void init() throws ServletException {
        System.out.println("init");
    }

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //你向外界提供的业务方法
        System.out.println("Service");
    }

    @Override
    public void destroy() {
        System.out.println("destory");
    }
}
